import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn, OneToOne, JoinColumn } from 'typeorm';
import { User } from './User';

@Entity()
export class Profile {
    @PrimaryGeneratedColumn()
    id: number;

    @Column({ type: "text" })
    bio: string;

    @CreateDateColumn()
    createdAt: Date;

    @UpdateDateColumn()
    updatedAt: Date;

    // 指定
    @OneToOne(() => User, (user) => user.profile, {
        cascade: true,
        eager: true,
    })
    @JoinColumn()
    user: User
}
